#include "filesystem.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
	bool exit = false;
	std::string path;
	system("clear");
	while( !exit ) {
		std::cout << "\n";
		std::cout << "===============================================\n";
		std::cout << "1\tmount device\n"
			 << "2\tprints content of specified dir\n"
			 << "3\tdump directory tree\n"
			 << "4\tdump inode tree\n"
			 << "5\tprocess inode nr\n"
			 << "0\tStoppen\n"
			 << "Select Option:\n";
		int option;
		std::cin >> option;
		switch (option) {
		 case 1:
			std::cout << "Device:";
			std::cin >> path;
			FileSystem::instance()->mountFS(path.c_str());
			break;
		 case 2:
			std::cout << "Select Path: ";std::cin >> path;
			FileSystem::instance()->processPath(path);
			break;
		 case 3:
			FileSystem::instance()->dumpDirTree();
			break;
		 case 4:
			FileSystem::instance()->dumpInodeTree();
			break;
		 case 5:
			int nodenr;
			std::cout << "Select Inode Nr: ";std::cin >> nodenr;
			FileSystem::instance()->processInode(nodenr);
			break;
		 case 0:
			exit = true;
			break;
		 default:
			std::cout << " Usage: dir [name] / file [name]\n";
			break;
		}
	}

	//FileSystem::instance()->mountFS("floppie");
    return (0);
}
